home *** CD-ROM | disk | FTP | other *** search
- global gDBPicttextVarList
-
- on InitLayOut
- MyObj = getaProp(gDBPicttextVarList, GetObjProp())
- SetSaveObj(MyObj)
- ShowTitle()
- EnableScroll = ShowPictandText()
- InitScrollLoc()
- InitButtons(EnableScroll)
- updateStage()
- SetScrollHandler()
- InitRollOverText(MyObj)
- end
-
- on ShowTitle
- MyObj = getaProp(gDBPicttextVarList, GetObjProp())
- SpriteList = GetSpriteList(MyObj)
- TitleSprite = getaProp(SpriteList, #title)
- xMember = member("title f")
- puppetSprite(TitleSprite, 1)
- set the textHeight of member xMember to 14
- set the member of sprite TitleSprite to xMember
- xLoc = point(20, 5)
- if the machineType = 256 then
- set the loc of sprite TitleSprite to xLoc + point(0, -1)
- else
- set the loc of sprite TitleSprite to xLoc
- end if
- end
-
- on ShowPictandText
- MyObj = getaProp(gDBPicttextVarList, GetObjProp())
- xMemberNum = GetTextMemberNum(MyObj)
- PictMemberNum = GetArtMember(MyObj)
- SpriteList = GetSpriteList(MyObj)
- SetPuppetState(SpriteList, #n, 1)
- PictSp = getaProp(SpriteList, #Art)
- set the member of sprite PictSp to PictMemberNum
- PictRect = GetPictRect(MyObj)
- set the rect of sprite PictSp to PictRect
- return CalcTextSize(SpriteList, xMemberNum, PictRect)
- end
-
- on CalcTextSize SpriteList, xMemberNum, PictRect
- MyObj = getaProp(gDBPicttextVarList, GetObjProp())
- TextSprite = getaProp(SpriteList, #text)
- NArrowSp = getaProp(SpriteList, #NArrow)
- MinRect = GetTextRect(MyObj, 1)
- CharMap(member(xMemberNum))
- if the machineType = 256 then
- PictRect = PictRect + rect(0, -1, 0, -1)
- MinRect = MinRect + rect(0, -1, 0, -1)
- set the textHeight of member xMemberNum to 14
- end if
- l = getAt(PictRect, 3) + 15
- t = getAt(PictRect, 2)
- R = getAt(MinRect, 3) - the width of sprite NArrowSp - 5
- b = getAt(MinRect, 4)
- TextSprite = getaProp(SpriteList, #text)
- EnableScroll = 0
- member(xMemberNum).scrollTop = 0
- member(xMemberNum).rect = rect(l, t, R, b)
- if member(xMemberNum).height > (GetRectHeight(rect(l, t, R, b)) + 2) then
- EnableScroll = 1
- end if
- set the member of sprite TextSprite to member(xMemberNum)
- set the loc of sprite TextSprite to point(l, t)
- return EnableScroll
- end
-
- on CharMap xMember
- if the machineType = 256 then
- if count(the windowList) > 0 then
- FieldFindandReplace(xMember, numToChar(147), QUOTE)
- FieldFindandReplace(xMember, numToChar(148), QUOTE)
- FieldFindandReplace(xMember, numToChar(145), "'")
- FieldFindandReplace(xMember, numToChar(146), "'")
- end if
- end if
- end
-
- on FieldFindandReplace xMember, FindText, ReplaceText
- xText = member(xMember).text
- PositionList = []
- start = the ticks
- repeat while xText contains FindText
- Pos = offset(FindText, xText)
- append(PositionList, Pos)
- put " " into char Pos of xText
- end repeat
- start = the ticks
- repeat with xItem in PositionList
- put ReplaceText into char xItem of field xMember
- end repeat
- end
-
- on InitScrollLoc
- MyObj = getaProp(gDBPicttextVarList, GetObjProp())
- ButtonList = GetButtonList(MyObj)
- InnerRect = GetInsideRect(the rect of sprite 2, 2)
- xRect = GetTextRect(MyObj, 1)
- SpriteList = GetSpriteList(MyObj)
- TargMember = GetTextMemberNum(MyObj)
- BedSp = getaProp(SpriteList, #VBed)
- NArrowSp = getaProp(SpriteList, #NArrow)
- SArrowSp = getaProp(SpriteList, #SArrow)
- ThumbSp = getaProp(SpriteList, #VThumb)
- sL = getAt(InnerRect, 3) - the width of sprite NArrowSp
- sT = getAt(xRect, 2)
- sR = getAt(InnerRect, 3)
- sB = getAt(InnerRect, 4)
- set the rect of sprite BedSp to rect(sL, sT, sR, sB)
- set the rect of sprite NArrowSp to rect(sL, sT, sR, sT + the height of sprite NArrowSp)
- set the rect of sprite SArrowSp to rect(sL, sB - the height of sprite SArrowSp, sR, sB)
- ThumbXLoc = sL + (the width of sprite NArrowSp / 2)
- ThumbMin = sT + the height of sprite NArrowSp + (the height of sprite ThumbSp / 2) - 2
- ThumbMax = sB - the height of sprite SArrowSp - (the height of sprite ThumbSp / 2)
- set the loc of sprite ThumbSp to point(ThumbXLoc, ThumbMin)
- MinRect = GetTextRect(MyObj, 1)
- numLines = member(TargMember).lineCount
- numVisLines = GetRectHeight(MinRect) / the textHeight of member TargMember
- numSettings = numLines - numVisLines + 1
- addProp(ButtonList, ThumbSp, new(script("scroll thumb sub"), "v scroll", "global", ThumbSp, ThumbXLoc, ThumbMin, ThumbMax, 1, numSettings, 1, numSettings, 0, 0, #downOrRight))
- Slider = getaProp(ButtonList, ThumbSp)
- addProp(ButtonList, BedSp, new(script("scroll bed sub"), "v scroll", "global", BedSp, RectToLoc(rect(sL, sT, sR, sB)), Slider, 15))
- addProp(ButtonList, NArrowSp, new(script("scroll Button"), "scrollup", "global", NArrowSp, the loc of sprite NArrowSp, Slider, 0))
- addProp(ButtonList, SArrowSp, new(script("scroll Button"), "scrolldown", "global", SArrowSp, the loc of sprite SArrowSp, Slider, 1))
- SetButtonList(MyObj, ButtonList)
- end
-
- on SetScrollHandler
- MyObj = getaProp(gDBPicttextVarList, GetObjProp())
- SetScrollProps(MyObj)
- end
-